home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mmdf / mmdf-IIb.43 / src / shellfiles / path2mmdf.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1988-03-28  |  1.6 KB  |  50 lines

  1. #! /bin/sh
  2. #
  3. # Create domain and channel tables from the pathalias database
  4. #
  5. # Mark Vasoll
  6. # Computing and Information Sciences   Internet:  vasoll@a.cs.okstate.edu
  7. # Oklahoma State University            UUCP:  {cbosgd, ihnp4, rutgers, seismo,
  8. # Stillwater, Oklahoma                         uiucdcs}!okstate!vasoll
  9. #
  10. PATHS=/tmp/t1$$
  11. DOMAINS=/tmp/t2$$
  12. NODOM=/tmp/t3$$
  13. SUMMARY=/tmp/t4$$
  14. #
  15. MAPFILE=../../Sys/okstate.map
  16. VALIDDOMS="edu gov mil com org net arpa au ch de fi fr il jp kr nl nz se uk us"
  17. #
  18. #  create pathalias output, separate into domain and non-domain entries
  19. #
  20. pathalias -v $MAPFILE d.* u.* >$PATHS
  21. egrep '[^     ]*\.[^     ]*    ' <$PATHS | sed 's/^\.//' | sort -fu >$DOMAINS
  22. egrep -v '[^     ]*\.[^     ]*    ' <$PATHS >$NODOM
  23. #
  24. #  generate some interesting stats
  25. #
  26. awk '{split($2, arr, "!"); print arr[1];}' <$PATHS >$SUMMARY
  27. echo count neighbor
  28. sort <$SUMMARY | uniq -c
  29. #
  30. #  clobber old output files
  31. #
  32. rm mmdf.topdom mmdf.uucpdom mmdf.uucpchan /tmp/wk$$ 2>/dev/null
  33. #
  34. #  use only those entries that contain valid top-levels
  35. #
  36. for i in $VALIDDOMS
  37. do
  38.     egrep -i "\.$i[     ]" $DOMAINS >>/tmp/wk$$
  39. done
  40. #
  41. #  generate a "fake" .UUCP domain table for "non-domain" UUCP sites
  42. #  to belong to.  also make a suplimental "top-domain" table that
  43. #  includes the domains from pathalias.  also make the UUCP channel
  44. #  table.
  45. awk '{printf "%s:%s.UUCP\n", $1, $1;}' $NODOM >mmdf.uucpdom
  46. awk '{printf "%s.UUCP:%s\n", $1, $2;}' $NODOM >mmdf.uucpchan
  47. awk '{printf "%s:%s\n", $1, $1;}' /tmp/wk$$ >mmdf.topdom
  48. awk '{printf "%s:%s\n", $1, $2;}' /tmp/wk$$ >>mmdf.uucpchan
  49. rm $PATHS $DOMAINS $NODOM $SUMMARY /tmp/wk$$
  50.